package ejb.casacentral.persistence.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table
@NamedQueries({
	@NamedQuery(name ="GrupoIP.todas",query="select s from GrupoIP s "),
	@NamedQuery(name ="GrupoIP.porCodigo",query="select s from GrupoIP s where s.codigo = :codigo"),
	@NamedQuery(name ="GrupoIP.proveedores",query="select s from GrupoIP s where s.tipo = 'Proveedor'"),
	@NamedQuery(name ="GrupoIP.oficinaVenta",query="select s from GrupoIP s where s.tipo = 'OfiVenta'")
})
public class GrupoIP  implements Serializable{
	

	private static final long serialVersionUID = -4188573559563929106L;
	@Id
	private String codigo;
	@Column
	private String ip;
	@Column
	private String tipo;
	@Column
	private String endpoint;
	@Override
	public String toString() {
		return "GrupoIP [codigo=" + codigo + ", ip=" + ip + ", tipo=" + tipo
				+ ", endpoint=" + endpoint + "]";
	}
	public String getCodigo() {
		return codigo;
	}
	public void setCodigo(String codigo) {
		this.codigo = codigo;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public String getTipo() {
		return tipo;
	}
	public void setTipo(String tipo) {
		this.tipo = tipo;
	}
	public String getEndpoint() {
		return endpoint;
	}
	public void setEndpoint(String endpoint) {
		this.endpoint = endpoint;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((codigo == null) ? 0 : codigo.hashCode());
		result = prime * result
				+ ((endpoint == null) ? 0 : endpoint.hashCode());
		result = prime * result + ((ip == null) ? 0 : ip.hashCode());
		result = prime * result + ((tipo == null) ? 0 : tipo.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		GrupoIP other = (GrupoIP) obj;
		if (codigo == null) {
			if (other.codigo != null)
				return false;
		} else if (!codigo.equals(other.codigo))
			return false;
		if (endpoint == null) {
			if (other.endpoint != null)
				return false;
		} else if (!endpoint.equals(other.endpoint))
			return false;
		if (ip == null) {
			if (other.ip != null)
				return false;
		} else if (!ip.equals(other.ip))
			return false;
		if (tipo == null) {
			if (other.tipo != null)
				return false;
		} else if (!tipo.equals(other.tipo))
			return false;
		return true;
	}
	public GrupoIP(String codigo, String ip, String tipo, String endpoint) {
		super();
		this.codigo = codigo;
		this.ip = ip;
		this.tipo = tipo;
		this.endpoint = endpoint;
	}
	public GrupoIP() {
		super();
	}
	
	
	
	
	

}
